package cn.com.wdjedu.androidapp.wjeduandroid.ui.mainfragment;

import android.content.Context;
import android.widget.ImageView;

import com.nostra13.universalimageloader.core.ImageLoader;
import com.zhy.adapter.recyclerview.CommonAdapter;
import com.zhy.adapter.recyclerview.base.ViewHolder;

import java.util.List;

import cn.com.wdjedu.androidapp.wjeduandroid.R;
import cn.com.wdjedu.androidapp.wjeduandroid.support.lib.Constanct;

/**
 * Created by CCY on 2017/2/15.
 * 主页名师推荐视频，子适配器
 */

public class VideoItemSubRVAdapter extends CommonAdapter<MainBean.CourseBean.ContentBean> {

    private String title[];

    public VideoItemSubRVAdapter(Context context, int layoutId, List<MainBean.CourseBean.ContentBean> datas) {
        super(context, layoutId, datas);
    }

    @Override
    protected void convert(ViewHolder holder, MainBean.CourseBean.ContentBean videosBean, int position) {
      //  holder.setImageResource(R.id.item_image_icon, ImageLoader.getInstance().displayImage(videosBean.setVideo_default_image(),;););

        title=videosBean.getTitle().split("-");
        ImageLoader.getInstance().displayImage(Constanct.IMAGE_URL2 +videosBean.getImage(), (ImageView) holder.getView(R.id.item_image_icon));
        holder.setText(R.id.item_name,title[0]);
        holder.setText(R.id.item_unit_name,title[1]);
        holder.setText(R.id.item_price,String.valueOf(videosBean.getPrice())+"￥");
        holder.setText(R.id.item_study_number,videosBean.getStudy_number()+"人学习");
    }
}
